package com.springboot.service.impl;


import com.springboot.mapper.DoctorFieldFormMapper;
import com.springboot.mapper.DoctorInfoFormMapper;
import com.springboot.model.DoctorFieldForm;
import com.springboot.model.DoctorInfoForm;
import com.springboot.service.DoctorSetInfoViewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public  class DoctorSetInfoViewServiceImpl implements DoctorSetInfoViewService {
    @Autowired
    private DoctorFieldFormMapper doctorFieldFormMapper;
    @Autowired
    private DoctorInfoFormMapper doctorInfoFormMapper;

    //通过手机号查询医生
    @Override
    public DoctorInfoForm findDoctorsByTel(String tel)
    {
        DoctorInfoForm doctorInfoForm=doctorInfoFormMapper.selectByTel(tel);
        return doctorInfoForm;
    }

    //通过id查找医生科室（领域）
    @Override
    public DoctorFieldForm findDoctorsByID(Integer id)
    {
        DoctorFieldForm doctorFieldForm=doctorFieldFormMapper.selectDoctorFieldById(id);
        return  doctorFieldForm;
    }

    //更新医生信息表的内容
    @Override
    public int insertDoctorRank(DoctorInfoForm doctorInfoForm)
    {

        int a=doctorInfoFormMapper.updateByPrimaryKey(doctorInfoForm);
        System.out.println("更新职称rank成功！");
        return a;
    }

    //更新医生领域表的信息
    public int insertDoctorField(DoctorFieldForm doctorFieldForm)
    {
        int a= doctorFieldFormMapper.updateByPrimaryKey(doctorFieldForm);
        System.out.println("更新科室field成功！");
        return a;
    }

}
